from selenium.webdriver.common.by import By

from base.base_action import BaseAction


class LoginPage(BaseAction):
    go_login = By.XPATH, "//*[@text='已有账号，去登录']"
    un = By.XPATH, "//*[@text='请输入手机/昵称']"
    pw = By.ID, "com.yunmall.lc:id/logon_password_textview"
    login_button = By.XPATH, "//*[@text='登录']"

    def click_go_login(self):
        self.click(self.go_login)

    def input_un(self, text):
        self.send_keys(self.un, text)

    def input_pw(self, text):
        self.send_keys(self.pw, text)

    def click_login(self):
        self.click(self.login_button)
